﻿using Microsoft.CodeAnalysis;

namespace UIOC.CodeAnalysis.Diagnostics;

internal static class AutowiredAttributeReadOnlyDiagnostic {

    public const string DiagnosticId = "UIOC0011";

    private const string Title = "'[Autowired]' 只读分析";
    private const string MessageFormat = "字段 '{0}' 标记了 '[{1}]'，禁止赋值";
    private const string Description = "检测对标记了 '[Autowired]' 的字段进行赋值，此类字段禁止赋值";
    private const string Category = "Usage";

    public static readonly DiagnosticDescriptor Rule = new(
        DiagnosticId,
        Title,
        MessageFormat,
        Category,
        DiagnosticSeverity.Error,
        isEnabledByDefault: true,
        description: Description,
        customTags: [WellKnownDiagnosticTags.Unnecessary]
    );
}
